import { action, makeObservable, observable } from 'mobx'

export default class CounterStore {
  constructor () {
    this.count = 1
    makeObservable(this, {
      count: observable,
      increment: action.bound, // bound 锁死 this 指向
      decrement: action.bound
    })
  }
  increment () {
    this.count += 1
  }
  decrement () {
    this.count -= 1
  }
}
